package com.zhuyp.spring.boot.service;

import java.util.List;
import com.zhuyp.spring.boot.mapper.BaseMapper;

public abstract class BaseService<T, TE, M> implements BaseMapper<T, TE, M> {

	private BaseMapper<T, TE, M> baseMapper;

	public void setBaseMapper(BaseMapper<T, TE, M> baseMapper) {
		this.baseMapper = baseMapper;
	}

	@Override
	public int deleteByPrimaryKey(Integer id) {
		return baseMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(T record) {
		return baseMapper.insert(record);
	}

	@Override
	public int insertSelective(T record) {
		return baseMapper.insertSelective(record);
	}

	@Override
	public T selectByPrimaryKey(Integer id) {
		return baseMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(T record) {
		return baseMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(T record) {
		return baseMapper.updateByPrimaryKey(record);
	}

	@Override
	public long countByExample(TE example) {
		return baseMapper.countByExample(example);
	}

	@Override
	public int deleteByExample(TE example) {
		return baseMapper.deleteByExample(example);
	}

	@Override
	public List<T> selectByExample(TE example) {
		return baseMapper.selectByExample(example);
	}

	@Override
	public int updateByExampleSelective(T record, TE example) {
		return baseMapper.updateByExampleSelective(record, example);
	}

	@Override
	public int updateByExample(T record, TE example) {
		return baseMapper.updateByExample(record, example);
	}
	
	@Override
	public long countByT(T t) {
		return countByExample(createExample(t));
	}

	@Override
	public int deleteByT(T t) {
		return deleteByExample(createExample(t));
	}

	@Override
	public List<T> selectByT(T t) {
		return selectByExample(createExample(t));
	}

	@Override
	public int updateByTSelective(T t) {
		return updateByExampleSelective(t, createExample(t));
	}

	@Override
	public int updateByT(T t) {
		return updateByExample(t, createExample(t));
	}
	
}
